<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>查看挖矿收益</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    html {
      font-size: 62.5%;
    }

    img {
      width: auto;
      height: auto;
      max-width: 100%;
      max-height: 100%;
    }

    .main {
      width: 95%;
      margin: 0 auto;
      font-family: PingFangSC-Regular;
    }

    .banner {
      margin-top: 10px;
      padding-left: 10%;
      padding-right: 10%;
      padding-top: 20px;
      background: #eceff6;
      border-radius: 4px;
      padding-bottom: 30px;
    }

    .bannerItem {
      width: 100%;
      margin-top: 30px;
    }

    .bannerTitle {
      text-align: center;
      line-height: 32px;
      margin: 0 auto;
      color: white;
      letter-spacing: 1.72px;
      /* width: 100%; */
      height: 32px;
      background: #258bf7;
      border-radius: 2px;
      font-size: 12px;
      color: #ffffff;
      letter-spacing: -0.05px;
      display: flex;
      justify-content: space-between;
      padding: 0 5%;
    }

    .bannerItemTitle,
    .exchangeRecord {
      height: 38px;
      width: 100%;
      border-bottom: 1px solid rgba(0, 0, 0, 0.2);
      line-height: 38px;
    }

    .exchangeRecord_1 {
      height: 38px;
      width: 100%;
      border-bottom: 1px solid rgba(0, 0, 0, 0.2);
      line-height: 38px;
      margin-top: 20px;
      display: flex;
      justify-content: space-around;
    }

    .bannerItemTitle {
      height: 38px;
      width: 100%;
      border-bottom: 1px solid rgba(0, 0, 0, 0.2);
      /* line-height: 38px; */
      display: flex;
      justify-content: space-around;
      -webkit-align-items: center;
      align-items: center;
    }

    .bannerItemName {
      height: 21px;
      width: 40px;
      color: black;
      text-align: center;
      line-height: 21px;
      font-size: 12px;
      /* float: left; */
      /* margin-top: 10px; */
    }

    .bannerItemValue {
      color: rgba(0, 0, 0, 0.5);
      font-size: 12px;
      color: #95989f;
      letter-spacing: 0.65px;
    }

    .bannerItemValueSub {
      margin-left: 3%;
      font-size: 12px;
      letter-spacing: 0.65px;
      width: 80px;
      text-align: center;
    }

    .bannerItemValueSub_1 {
      font-size: 12px;
      letter-spacing: 0.65px;
      width: 80px;
      text-align: center;
      color: red;
      margin-left: 3%;
    }

    .bannerItemValue_1 {
      color: rgba(0, 0, 0, 0.5);
      margin-left: 10%;
      font-size: 12px;
      color: #95989f;
      letter-spacing: 0.65px;
    }

    .exchangeRecord {
      display: flex;
      line-height: 38px;
      justify-content: space-around;
    }

    .jilu {
      padding-left: 5px;
      color: #4892fd;
      font-weight: bold;
      width: 35px;
    }

    .back {
      float: right;
      text-align: right;
      margin-right: 31px;
      margin-top: 5px;
      margin-bottom: 50px;
      font-family: PingFangSC-Regular;
      font-size: 12px;
      color: #95989F;
      letter-spacing: 0.45px;
    }

    .bannerItem .exchangeRecord:last-child {
      border-bottom: 2px solid #c5c4c9;
    }

    .draw {
      display: block;
      width: 53px;
      height: 20px;
      background: #3962f2;
      border-radius: 7px;
      font-size: 10px;
      color: #ffffff;
      letter-spacing: 0.21px;
      /* margin-top: 10px; */
      text-align: center;
      margin-top: 15px;
      text-align: center;
      line-height: 20px;
      margin-left: 3%;
      float: right;
      margin-bottom: 12px;

    }

    .input {
      border: none;
      height: 21px;
      margin-left: 3%;
      padding-left: 5px;
      margin-top: 10px;
      padding-right: 5px;
    }

    .input::-webkit-input-placeholder {
      /* placeholder颜色  */
      color: #95989f;
      /* placeholder字体大小  */
      font-size: 10px;
      /* placeholder位置  */
      text-align: left;

    }

    .lastMargin {
      margin-left: 3%;
      width: 158px;
    }

    .walletAddress {
      height: 50px;
      background: white;
      border-radius: 2px;
      /* line-height: 50px; */
      /* padding-left: 13%; */
      box-shadow: 0 1px 5px #E8E5EE;
      margin-top: 15px;
      position: relative;
      display: flex;
      align-items: center;
    }

    .walletAddress span {
      display: block;
      color: black;
      font-size: 12px;
      font-weight: bold;
      height: 18.1px;
      margin-left: 1%;
      line-height: 18.1px;
      width: 65px;
    }

    .walletAddress .hideWord {
      display: block;
      border-left: 1.5px solid rgba(0, 0, 0, 0.2);
      padding: 0 0 0 12px;
      margin-left: 8px;
      font-size: 12px;
      color: #979797;
      letter-spacing: -0.05px;
      text-align: left;
      height: 18.1px;
      line-height: 18.1px;
    }

    .walletAddressImg {
      width: 21.6px;
      height: 18.1px;
      margin-left: 10%;
    }

    .paging {
      display: flex;
      justify-content: space-around;
      margin-top: 5px;
    }

    .jiaoyi {
      padding-left: 5px;
      color: #4892fd;
      font-weight: bold;
      width: 130px
    }

    .NoData {
      font-size: 20px;
      color: black;
    }

    .refreshButton {
      width: 65px;
      height: 30px;
      border: 1px solid white;
      line-height: 30px;
      text-align: center;
      margin: 20px auto;
    }

    .exchangeRecord_2 {
      width: 100%;
      text-align: center;
      font-size: 20px;
      margin-top: 30px;
    }

    .tishi {
      margin-top: 16px;
      font-size: 13px;
      color: red;
      display: flex;
      flex-direction: column;
    }
  </style>
</head>

<body>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  <script src="./vue.min.js"></script>
  <script src='./set.js'></script>
  <link rel="stylesheet" type="text/css" href="http://unpkg.com/iview/dist/styles/iview.css">
  <script type="text/javascript" src="http://unpkg.com/iview/dist/iview.min.js"></script>

  <div id="wrapp">
    <div class="main">
      <div class="walletAddress">
        <div class="walletAddressImg">
          <img src="./assets/wallet.png" alt="">
        </div>
        <span>ERC20地址</span>
        <span type="text" class="hideWord">{{walletAddress | hideWord}}</span>
      </div>
      <div class="banner">
        <div class="bannerTitle">
          <span>{{coinName}}</span>
          <span v-if="coinName=='STORJ'">{{mortgageData.storjsincome | showWord_8}}</span>
          <span v-if="coinName=='FILECOIN'">{{mortgageData.filsincome | showWord_8}}</span>
          <span v-if="coinName=='PLC'">{{mortgageData.plcsincome | showWord_8}}</span>
        </div>
        <span class="draw" @click="draw_storj" v-if="coinName=='STORJ'">提现</span>
        <span class="draw" @click="draw_fil" v-if="coinName=='FILECOIN'">提现</span>
        <span class="draw" @click="draw_plc" v-if="coinName=='PLC'">提现</span>
        <!-- storj -->
        <div class="bannerItem" v-if="coinName=='STORJ'">
          <div class="bannerItemTitle">
            <span class="bannerItemName">类型</span>
            <span class="bannerItemValueSub" style="text-align:center">时间</span>
            <span class="bannerItemValueSub_1" style="text-align:center;color: black">数量</span>
            <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px">状态</span>
          </div>
          <div v-if="historyData.length>0">
            <div class="exchangeRecord" v-for="subItem in historyData">
              <span class="jilu">{{subItem.type}}</span>
              <span class="bannerItemValueSub">{{subItem.timestamp}}</span>
              <span class="bannerItemValueSub_1">{{subItem.storjcash}}<span style="color:black">STORJ</span></span>
              <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px;color: blue" v-if="subItem.states=='提现成功'">{{subItem.states}}</span>
              <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px;" v-else-if="subItem.states=='正在提现'">{{subItem.states}}</span>
              <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px; color: red" v-else>{{subItem.states}}</span>
            </div>
            <Page :total="dataCount" :page-size="pageSize" class="paging" @on-change="changepage"></Page>
            <div class="tishi"><span>温馨提示：</span><span>STORJ收益结算周期：30天，月中结算</span></div>
          </div>
          <div class="exchangeRecord_2" v-else>
            <div v-if="getShouYiData.length==0">暂无数据</div>
            <div v-else>
              <span>系统繁忙，请刷新重试</span>
              <div class="refreshButton" @click='refresh'>刷新</div>
            </div>
          </div>
        </div>


        <!-- FILECOIN -->
        <div class="bannerItem" v-if="coinName=='FILECOIN'">
          <div class="bannerItemTitle">
            <span class="bannerItemName">类型</span>
            <span class="bannerItemValueSub" style="text-align:center">时间</span>
            <span class="bannerItemValueSub_1" style="text-align:center;color: black">数量</span>
            <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px">状态</span>
          </div>
          <div v-if="historyData.length>0">
            <div class="exchangeRecord" v-for="subItem in historyData">
              <span class="jilu">{{subItem.type}}</span>
              <span class="bannerItemValueSub">{{subItem.timestamp}}</span>
              <span class="bannerItemValueSub_1">{{subItem.filcash}}<span style="color:black">FIL</span></span>
              <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px;color: blue" v-if="subItem.states=='提现成功'">{{subItem.states}}</span>
              <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px;" v-else-if="subItem.states=='正在提现'">{{subItem.states}}</span>
              <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px; color: red" v-else>{{subItem.states}}</span>
            </div>
            <Page :total="dataCount" :page-size="pageSize" class="paging" @on-change="changepage"></Page>

          </div>
          <div class="exchangeRecord_2" v-else>
            <div v-if="getShouYiDataFil.length==0">暂无数据</div>
            <div v-else>
              <span>系统繁忙，请刷新重试</span>
              <div class="refreshButton" @click='refresh'>刷新</div>
            </div>
          </div>
        </div>
        <!-- PLC -->
        <div class="bannerItem" v-if="coinName=='PLC'">
          <div class="bannerItemTitle">
            <span class="bannerItemName">类型</span>
            <span class="bannerItemValueSub" style="text-align:center">时间</span>
            <span class="bannerItemValueSub_1" style="text-align:center;color: black">数量</span>
            <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px">状态</span>
          </div>
          <div v-if="historyData.length>0">
            <div class="exchangeRecord" v-for="subItem in historyData">
              <span class="jilu">{{subItem.type}}</span>
              <span class="bannerItemValueSub">{{subItem.timestamp}}</span>
              <span class="bannerItemValueSub_1">{{subItem.plccash}}<span style="color:black">PLC</span></span>
              <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px;color: blue" v-if="subItem.states=='提现成功'">{{subItem.states}}</span>
              <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px;" v-else-if="subItem.states=='正在提现'">{{subItem.states}}</span>
              <span style="margin-left: 3%;width: 50px;text-align: center;font-size:12px; color: red" v-else>{{subItem.states}}</span>
            </div>
            <Page :total="dataCount" :page-size="pageSize" class="paging" @on-change="changepage"></Page>
            <div class="tishi">温馨提示：PLC收益结算周期：24小时</div>
          </div>

          <div class="exchangeRecord_2" v-else>
            <div v-if="getShouYiDataPLC.length==0">暂无数据</div>
            <div v-else>
              <span>系统繁忙，请刷新重试</span>
              <div class="refreshButton" @click='refresh'>刷新</div>
            </div>
          </div>

        </div>
      </div>
    </div>
    <div class="back" @click="backTo">返回&nbsp;&nbsp;&nbsp;></div>
  </div>
  <script>
    let app = new Vue({
      el: "#wrapp",
      data: {
        ready: true,
        apple: true,
        walletValue: "",
        exchangeDataStorj: [],
        exchangeDataPLC: [],
        exchangeDataFIL: [],
        session: '',
        wholeData: [],
        value_storj: '',
        value_plc: '',
        value_fil: '',
        walletAddress: '',
        subData: [],
        PLCreadySuccess: [],
        PLCalreadySuccess: [],
        FILreadySuccess: [],
        FILalreadySuccess: [],
        STORJreadySuccess: [],
        STORJalreadySuccess: [],
        mortgageData: {},
        coinName: '',
        //提现分页数据
        ajaxHistoryData: [],
        // 初始化信息总条数
        dataCount: 0, //提现总数
        // 每页显示多少条
        pageSize: 10,
        historyData: [],
        histories: [],

        //交易记录分页数据
        historiesJiaoyiStroj: [],
        dataCount_1: 0, //交易记录总数
        historyDataJiaoyi: [],
        ajaxHistoryDataJiaoyi: [],

        //收益数据
        getShouYiData: [], //storj
        getShouYiDataPLC: [], //plc
        getShouYiDataFil: [], //fil
      },
      filters: {
        //字符串隐藏处理
        hideWord: function (string) {
          string = String(string)
          let len = string.length;
          let stringBefore = string.slice(0, 11);
          let stringBeHand = string.slice(len - 10, len + 1);
          let newString = stringBefore + "..." + stringBeHand;
          return newString;
        },
        hideWord_1: function (string) {
          string = String(string)
          let len = string.length;
          let stringBefore = string.slice(0, 7);
          let stringBeHand = string.slice(len - 6, len + 1);
          let newString = stringBefore + "..." + stringBeHand;
          return newString;
        },
        //千位分隔符
        separation: function (num) { //自定义分隔函数方法

          let numpart = String(num).split("."); //将数字通过jq split用小数点分隔为数组对象
          numpart[0] = numpart[0].replace(new RegExp('(\\d)(?=(\\d{3})+$)', 'ig'), "$1,");
          //将数组对象第一个数据(整数部分)通过正则表达式每三位用逗号分隔
          return numpart.join("."); //把数组通过join方法用.进行拼接
        },
        showWord_8: function (num) {
          num = parseFloat(num)

          return num.toFixed(8);
        },
      },
      mounted() {
        this.shouyi('plc');
        this.shouyi('storj');
        this.shouyi('fil');
        this.loadData();
        this.tixian();
        this.getDiYa();
      },
      created() {
        this.session = this.parseURL().session;
        this.walletAddress = this.parseURL().wallet;
        this.coinName = this.parseURL().coinName;
      },
      methods: {
        //获取余额
        getDiYa() {
          let param = {};
          param["session"] = this.session;
          axios({
              method: "post",
              url: requestBaseUrl + "tianru/users/subsidy",
              data: param,
            })
            .then(res => {
              if (res.status == 200) {
                app.mortgageData = res.data.subsidy;
              }
            })
            .catch(err => {
              // alert("网络连接错误");
            });
        },
        backTo() {
          let url = appUrl + "login.html?session=" + this.session;
          window.location.href = url;
        },
        draw_storj() {
          window.location.href = appUrl + "walletDraw.html?session=" + this.session + "&wallet=" + this.walletAddress +
            "&coinName=" + "STORJ";
        },
        draw_fil() {
          window.location.href = appUrl + "walletDraw.html?session=" + this.session + "&wallet=" + this.walletAddress +
            "&coinName=" + "FILECOIN";
        },
        draw_plc() {
          window.location.href = appUrl + "walletDraw.html?session=" + this.session + "&wallet=" + this.walletAddress +
            "&coinName=" + "PLC";

        },
        todetail_PLC(ind) {
          window.location.href = appUrl + "exchangeDetail.html?type=" + 'plc' + "&id=" + ind + "&session=" + this.session +
            "&walletAddress=" + this.walletAddress;
        },
        todetail_storj(ind) {
          window.location.href = appUrl + "exchangeDetail.html?type=" + 'storj' + "&id=" + ind + "&session=" + this
            .session + "&walletAddress=" + this.walletAddress;
        },
        todetail_fil(ind) {
          window.location.href = appUrl + "exchangeDetail.html?type=" + 'fil' + "&id=" + ind + "&session=" + this.session +
            "&walletAddress=" + this.walletAddress;
        },
        //收益
        shouyi(coinName) {
          let param = {};
          param["session"] = this.session;
          param["page"] = -1;
          param["type"] = coinName;
          axios({
              method: "post",
              url: requestBaseUrl + "tianru/users/balances",
              data: param,
            })
            .then(res => {
              if (res.status == 200) {
                if (res.data.retcode == '00000') {
                  if (coinName == "storj") {
                    this.getShouYiData = res.data.datas;
                    this.getShouYiData.forEach(element => {
                      element.states = "收益到账";
                      element.type = "收益";
                      element.timestamp = this.shouyiTimeChuli(element.timestamp);
                      element.timestamp = this.shijianchuo(element.timestamp);
                      element.storjcash = this.toFix(element.storjbalance);
                    });
                  } else if (coinName == 'fil') {
                    this.getShouYiDataFil = res.data.datas;
                    let temp = [];
                    this.getShouYiDataFil.forEach(element => {
                      element.states = "收益到账";
                      element.type = "收益";
                      element.timestamp = this.shouyiTimeChuli(element.timestamp);
                      element.timestamp = this.shijianchuo(element.timestamp);
                      element.filcash = this.toFix(element.filbalance);
                    });
                  } else {
                    this.getShouYiDataPLC = res.data.datas;
                    let temp = [];
                    this.getShouYiDataPLC.forEach(element => {
                      element.states = "收益到账";
                      element.type = "收益";
                      element.plccash = this.toFix(element.plcbalance);
                      element.timestamp = this.shouyiTimeChuli(element.timestamp);
                      element.timestamp = this.shijianchuo(element.timestamp);
                    });
                  }
                } else if (res.data.retcode == '00006') {
                  alert('session已过期，重新登录');
                  window.location.href = "http://sky.valuechain.group/huijia/login.html";

                }
              }
            })
            .catch(err => {
              // alert(err);
            });
        },
        //提现记录
        tixian() {
          let param = {}
          param["session"] = this.session;
          axios({
              method: "post",
              url: requestBaseUrl + "tianru/users/cashes",
              data: param,
            })
            .then(res => {
              if (res.status == 200) {
                if (res.data.retcode = '00000') {
                  let tixianWhole = res.data.datas;
                  for (let i = 0; i < tixianWhole.length; i++) {
                    if (tixianWhole[i].iscash == false) {
                      if (tixianWhole[i].plccash != 0) {
                        app.PLCreadySuccess.push(tixianWhole[i]);
                      } else if (tixianWhole[i].storjcash != 0) {
                        app.STORJreadySuccess.push(tixianWhole[i]);
                      } else if (tixianWhole[i].filcash != 0) {
                        app.FILreadySuccess.push(tixianWhole[i]);
                      }
                    } else {
                      if (tixianWhole[i].plccash != 0) {
                        app.PLCalreadySuccess.push(tixianWhole[i]);
                      } else if (tixianWhole[i].storjcash != 0) {
                        app.STORJalreadySuccess.push(tixianWhole[i]);
                      } else if (tixianWhole[i].filcash != 0) {
                        app.FILalreadySuccess.push(tixianWhole[i]);
                      }
                    }
                  }
                  console.log("下面是第一次获取到PLC")
                  console.log(app.PLCreadySuccess);
                  console.log(app.PLCalreadySuccess);
                  if (app.PLCreadySuccess) {
                    for (let i = 0; i < app.PLCreadySuccess.length; i++) {
                      app.PLCreadySuccess[i].timestamp = app.chuliTime(app.PLCreadySuccess[i].timestamp);
                      app.PLCreadySuccess[i].timestamp = app.shijianchuo(app.PLCreadySuccess[i].timestamp);
                    }
                  }
                  if (app.FILreadySuccess) {
                    for (let i = 0; i < app.FILreadySuccess.length; i++) {
                      app.FILreadySuccess[i].timestamp = app.chuliTime(app.FILreadySuccess[i].timestamp);
                      app.FILreadySuccess[i].timestamp = app.shijianchuo(app.FILreadySuccess[i].timestamp);
                    }
                  }
                  if (app.STORJreadySuccess) {
                    for (let i = 0; i < app.STORJreadySuccess.length; i++) {
                      app.STORJreadySuccess[i].timestamp = app.chuliTime(app.STORJreadySuccess[i].timestamp);
                      app.STORJreadySuccess[i].timestamp = app.shijianchuo(app.STORJreadySuccess[i].timestamp);
                    }
                  }
                  if (app.PLCalreadySuccess) {
                    for (let i = 0; i < app.PLCalreadySuccess.length; i++) {
                      app.PLCalreadySuccess[i].timestamp = app.chuliTime(app.PLCalreadySuccess[i].timestamp);
                      app.PLCalreadySuccess[i].timestamp = app.shijianchuo(app.PLCalreadySuccess[i].timestamp);
                    }
                  }
                  if (app.FILalreadySuccess) {
                    for (let i = 0; i < app.FILalreadySuccess.length; i++) {
                      app.FILalreadySuccess[i].timestamp = app.chuliTime(app.FILalreadySuccess[i].timestamp);
                      app.FILalreadySuccess[i].timestamp = app.shijianchuo(app.FILalreadySuccess[i].timestamp);
                    }
                  }
                  if (app.STORJalreadySuccess) {
                    for (let i = 0; i < app.STORJalreadySuccess.length; i++) {
                      app.STORJalreadySuccess[i].timestamp = app.chuliTime(app.STORJalreadySuccess[i].timestamp);
                      app.STORJalreadySuccess[i].timestamp = app.shijianchuo(app.STORJalreadySuccess[i].timestamp);
                    }
                  }
                }

                let temp = [];
                if (app.coinName == "STORJ") {
                  app.STORJalreadySuccess.forEach(element => {
                    element.states = "提现成功"
                    element.type = "提现"
                    temp.push(element);
                  });
                  app.STORJreadySuccess.forEach(element => {
                    element.states = "正在提现";
                    element.type = "提现"
                    temp.push(element);
                  });
                  if (this.getShouYiData) {
                    this.getShouYiData.forEach(element => {
                      temp.push(element);
                    })
                  }

                  temp.sort(function (a, b) {
                    return b.timestamp - a.timestamp;
                  })
                  console.log(temp);
                  temp.forEach(element => {
                    element.timestamp = this.timestampToTime(element.timestamp)
                  })
                } else if (this.coinName == "FILECOIN") {
                  this.FILalreadySuccess.forEach(element => {
                    element.states = "提现成功"
                    element.type = "提现"
                    temp.push(element);
                  });
                  this.FILreadySuccess.forEach(element => {
                    element.states = "正在提现";
                    element.type = "提现"
                    temp.push(element);
                  });
                  if (this.getShouYiDataFil) {
                    this.getShouYiDataFil.forEach(element => {
                      temp.push(element);
                    })
                  };
                  temp.sort(function (a, b) {
                    return b.timestamp - a.timestamp;
                  })
                  console.log(temp);
                  temp.forEach(element => {
                    element.timestamp = this.timestampToTime(element.timestamp)
                  })
                } else {
                  this.PLCalreadySuccess.forEach(element => {
                    element.states = "提现成功"
                    element.type = "提现"
                    temp.push(element);
                  });
                  this.PLCreadySuccess.forEach(element => {
                    element.states = "正在提现";
                    element.type = "提现"
                    temp.push(element);
                  });
                  if (this.getShouYiDataPLC) {
                    this.getShouYiDataPLC.forEach(element => {
                      temp.push(element);
                    });
                  }
                  temp.sort(function (a, b) {
                    return b.timestamp - a.timestamp;
                  });
                  temp.forEach(element => {
                    element.timestamp = this.timestampToTime(element.timestamp)
                  });
                  console.log(temp);
                }
                this.histories = temp;
                this.handleListApproveHistory(this.histories);
              } else if (res.data.retcode == '00006') {
                alert('登录已过期，请重新登录');
                window.location.href = appUrl + 'login.html'
              }
              console.log("获取收益数据")
              console.log(app.getShouYiDataPLC);
            })
            .catch(err => {
              // alert(err);
            });
        },
        loadData() {
          axios({
              method: "get",
              url: "https://api.etherscan.io/api?module=account&action=tokentx&address=" + this.walletAddress +
                "&startblock=0&endblock=999999999&sort=asc&apikey=HUFI49TF2AUYIUBNAIKUJPRGAE6PZG93EC",
            })
            .then(res => {
              if (res.status == 200) {
                this.wholeData = res.data.result;
                if (this.wholeData) {
                  let index = this.wholeData.length;
                  for (let i = 0; i < index; i++) {
                    if (this.wholeData[i].tokenSymbol == 'STORJ') {
                      this.exchangeDataStorj.push(this.wholeData[i]);
                    } else if (this.wholeData[i].contractAddress == '0x031be1616b56ad0238bca275b7b0f6ec533676b5') {
                      this.exchangeDataPLC.push(this.wholeData[i]);
                    } else if (this.wholeData[i].tokenSymbol == 'FIL') {
                      this.exchangeDataFIL.push(this.wholeData[i]);
                    } else {
                      console.log('什么都没有获取到')
                    }
                  }
                  let temp = [];
                  if (this.coinName == "STORJ") {
                    this.exchangeDataStorj.forEach(element => {
                      temp.push(element);
                    });
                  } else if (this.coinName == "FILECOIN") {
                    this.exchangeDataFIL.forEach(element => {
                      temp.push(element);
                    });
                  } else {
                    this.exchangeDataPLC.forEach(element => {
                      temp.push(element);
                    });
                  }
                  this.historiesJiaoyiStroj = temp;
                  this.handleListApproveHistory_1(this.historiesJiaoyiStroj);
                }
              }
            })
            .catch(err => {
              // alert("网络连接错误");
            });
        },
        //时间戳
        timestampToTime(timestamp) {
          // date = new Date(Date.parse(timestamp.replace(/-/g,"/"))).getTime();
          // date = new Date(Date.parse(timestamp.replace(/-/g,"/")));

          var date = new Date(timestamp);
          Y = date.getFullYear() + '-';
          M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
          D = date.getDate() + ' ';
          h = date.getHours() + ':';
          m = date.getMinutes();
          if (m == '0') {
            m = '00'
          }
          return M + D + h + m;
        },
        //分页函数
        handleListApproveHistory(histories) {
          // 保存取到的所有数据
          this.ajaxHistoryData = histories
          this.dataCount = histories.length;
          // 初始化显示，小于每页显示条数，全显，大于每页显示条数，取前每页条数显示
          if (histories.length < this.pageSize) {
            this.historyData = this.ajaxHistoryData;
          } else {
            this.historyData = this.ajaxHistoryData.slice(0, this.pageSize);
          }
        },
        handleListApproveHistory_1(histories) {
          // 保存取到的所有数据
          this.ajaxHistoryDataJiaoyi = histories
          this.dataCount_1 = histories.length;
          // 初始化显示，小于每页显示条数，全显，大于每页显示条数，取前每页条数显示
          if (histories.length < this.pageSize) {
            this.historyDataJiaoyi = this.ajaxHistoryDataJiaoyi;
          } else {
            this.historyDataJiaoyi = this.ajaxHistoryDataJiaoyi.slice(0, this.pageSize);
          }
        },
        //分页点击函数
        changepage(index) {
          var _start = (index - 1) * this.pageSize;
          var _end = index * this.pageSize;
          this.historyData = this.ajaxHistoryData.slice(_start, _end);
        },
        changepage_1(index) {
          var _start = (index - 1) * this.pageSize;
          var _end = index * this.pageSize;
          this.historyDataJiaoyi = this.ajaxHistoryDataJiaoyi.slice(_start, _end);
        },
        parseURL: function (_url) {
          let queryString = '';
          let url = _url || location.href;
          let index = url.lastIndexOf('?');
          let map = {};
          /* 如果当前 url 没有 query-string*/
          if (index > -1) {
            let queryString = url.slice(index).split('?')[1];
            queryString.split('&').forEach(function (item) {
              let t = item.split('=');
              map[t[0]] = t[1];
            });
          }
          return map;
        },
        chuliTime: function (time) {
          time = String(time);
          let index = time.lastIndexOf(":");
          let year = time.slice(0, 4);
          let mon = time.slice(4, 6);
          let day = time.slice(6, 8);
          let fen = time.slice(9, index);
          time = year + "-" + mon + "-" + day + " " + fen;
          return time;
        },
        shijianchuo(time) {
          let date = new Date(time.replace(/-/g, '/'));
          return date.getTime();
        },
        shouyiTimeChuli(time) {
          time = String(time);
          let year = time.slice(0, 4);
          let mon = time.slice(4, 6);
          let day = time.slice(6, 8);
          let fen = time.slice(8, 10);
          let second = time.slice(10, 12)
          time = year + "-" + mon + "-" + day + " " + fen + ":" + second;
          return time;
        },
        refresh() {
          location.reload()
        },
        toFix(num) {
          let str = String(num);
          let dot = str.indexOf('.');
          let xs = str.slice(dot + 1);
          if (xs.length < 3) {
            return str;
          } else {
            return str.slice(0, dot + 4);
          }
        }
      }

    })
  </script>
</body>

</html>